package com.wangsd.web.face.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.wangsd.web.face.entity.ReceiveRecord;
import com.wangsd.web.face.mapper.ReceiveRecordMapper;
import com.wangsd.web.face.service.ReceiveRecordService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author generator
 * @since 2019-09-26
 */
@Service
public class ReceiveRecordServiceImpl extends ServiceImpl<ReceiveRecordMapper, ReceiveRecord> implements ReceiveRecordService {

    @Resource
    ReceiveRecordMapper receiveRecordMapper;


    @Override
    public void updateStatus(String outOrderNo, int status) {
        //批量修改分账状态，谨慎操作
        ReceiveRecord receiveRecord = new ReceiveRecord();
        receiveRecord.setStatus(status);

        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("out_order_no",outOrderNo);

        receiveRecordMapper.update(receiveRecord,queryWrapper);
    }

    @Override
    public Integer selectCountByOutOrderNo(String outOrderNo) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("out_order_no", outOrderNo);
        return receiveRecordMapper.selectCount(queryWrapper);
    }
}
